import request from "@/utils/request";

// 新增帖子
export function addPostApi(data: any) {
  return request({
    url: "/post/add_post",
    method: "post",
    data,
  });
}

// 根据帖子id获取帖子
export function getPostApi(id: any) {
  return request({
    url: "/post/get_post",
    method: "get",
    params: {
      id: id,
    },
  });
}

// 获取帖子列表
export function getPostListApi(params: any) {
  return request({
    url: "/post/get_post_list",
    method: "get",
    params,
  });
}

// 更新帖子
export function updatePostApi(data: any) {
  return request({
    url: "/post/update_post",
    method: "put",
    data,
  });
}

// 删除帖子
export function deletePostApi(data: any) {
  return request({
    url: "/post/delete_post",
    method: "delete",
    data,
  });
}

// 新增评论
export function addCommentApi(data: any) {
  return request({
    url: "/comment/add_comment",
    method: "post",
    data,
  });
}
